
// 	ID : pallab81
// 	PROG : 10564
// 	LANG : C++
// 	2011-08-19-00.07.17 Friday
//
// 	"I have not failed, I have just found 10000 ways that won't work.
//


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>

using namespace std;

#define CI( x ) scanf("%d",&x)
#define CL( x ) scanf("%lld",&x)
#define CD( x ) scanf("%lf",&x )
#define fo(i,ed) for(int i = 0 ; i < ed ; ++i )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )

inline void wait( double seconds ) {
    double endtime = clock() + ( seconds+ CLOCKS_PER_SEC );
    while( clock() < endtime ) {
        ;
    }
}

int N,S;
int grid[ 40 ][ 21 ];
Int cando[ 40 ][ 21 ][ 510 ];
int row;

inline void Read() {
    row = N*2 - 1;
    int r,i,j;
    for(r=1,i=N; r<N; ++r,--i) {
        for(j=1; j<=i; ++j) {
            CI(grid[r][j]);
        }
    }
    for( i=1; r<=row; ++r,++i ) {
        for(j=1; j<=i; ++j) {
            CI(grid[r][j]);
        }
    }
}
inline Int go(int r, int c, int sum) {
    if( r==row ) {
        return (Int)( grid[r][c]==sum ) ;
    }
    if( sum < 0 ) {
        return 0;
    }

    Int &ways = cando[ r ][ c ][ sum ];
    if( ways!=-1 ) {
        return ways;
    }
    ways=0;
    int rest = sum-grid[r][c];
    if( r < N ) {
        if( c-1 >=1 ) {
            ways+= go( r+1, c-1, rest );
        }
        if( c <= (N-r)) {
            ways+= go( r+1, c, rest );
        }
    } else {
        ways+=go( r+1, c, rest );
        ways+=go( r+1, c+1, rest );
    }
    return ways;
}
inline string back_track(int r, int c, int sum ) {
    if( r == row ) {
        return "";
    }
    int rest = sum-grid[r][c];
    if( rest >=0 && cando[r][c][sum]!=-1 && cando[r][c][sum] ) {
        if( r < N ) {
            if( c-1 >=1 ) {
                if( go(r+1,c-1, rest) ) {
                    return 'L'+back_track(r+1,c-1, rest);
                }
            }
            if( c <= (N-r) ) {
                if( go(r+1,c,rest)) {
                    return 'R'+back_track(r+1,c, rest );
                }
            }
        } else {
            if( go(r+1,c,rest) ) {
                return 'L'+ back_track(r+1,c, rest );
            } else if( go(r+1,c+1,rest)) {
                return 'R'+back_track(r+1,c+1,rest );
            }
        }
    }
    return "";
}

inline void Proc() {
    SET( cando,-1);
    Int ways=0;
    for( int i=1; i <=N; ++i) {
        ways+=go(1,i,S);
    }
    printf("%lld\n",ways);
    if( ways==0 ) {
        printf("\n");
    } else {

        for(int i=1; i<=N; ++i) {
            string res = back_track( (int)1, i,S);
            if( res !="" ) {
                printf("%d %s\n",i-1,res.c_str());
                return ;
            }
        }
    }
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("in.txt","rt",stdin);
#endif
    //  cout<<sizeof(cando)/1024/1024<<"\n";

    while( scanf("%d %d",&N,&S)==2 ) {
        if(N==0 && S==0 ) {
            break;
        }
        Read();
        Proc();
    }

    return 0;
}
